<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-07-31 17:46:49
 * @LastEditTime: 2020-03-14 22:06:46
 * @LastEditors: Please set LastEditors
 -->
<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>Hello APP</title>
	<link rel="stylesheet" type="text/css" href="../../css/vant.css">
	<link rel="stylesheet" type="text/css" href="../../css/base.css" />
	<script type="text/javascript" src="../../script/jquery.js"></script>
	<script type="text/javascript" src="../../script/layer/mobile/layer.js"></script>
	<script type="text/javascript" src="../../script/vue.min.js"></script>
	<script type="text/javascript" src="../../script/vant.min.js"></script>
	<script type="text/javascript" src="../../script/fastclick.js"></script>
	<script type="text/javascript" src="../../script/base.js"></script>
	<style type="text/css">
		html,
		body,
		#app,
		.init-full {
			height: auto;
		}

		.init-full {
			background: rgba(0, 0, 0, .7);
			border-radius: 6px;
			overflow: hidden;
		}

		.van-cell {
			background: transparent;
			color: #fff;
			padding: 4px 16px;

		}

		.van-cell__value {
			color: #fff;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.van-cell:not(:last-child)::after {
			border-bottom: 0;
		}
	</style>
</head>

<body>
	<div id="app" v-cloak>
		<div class="init-full" @click="openNav">
			<van-cell title="名称" :value="signData.ClientName"></van-cell>
			<van-cell title="联系方式">
				<a style="color:#3cd2ff;text-decoration: underline;" :href="'tel:' + signData.FLXS"
					@click.stop="">{{signData.LinkTelphone}}</a>
			</van-cell>
			<van-cell title="负责人" :value="signData.LinkName"></van-cell>
		</div>
	</div>
</body>

<script type="text/javascript">
	var vm;
	apiready = function () {
		//$('.init-full').show();

		var maps = [
			['高德地图', 'iosamap://', 'com.autonavi.minimap'],
			['百度地图', 'baidumap://', 'com.baidu.BaiduMap']
		];
		var buttons = [];

		api.addEventListener({
			name: 'setSignData'
		}, function (ret, err) {
			vm.signData = ret.value.signData;
		})

		var signData = api.pageParam.signData;

		vm = new Vue({
			el: '#app',
			data: {
				signData: signData
			},
			created: function () {
				this.appInstalled();
			},
			methods: {
				openNav() {
					var that = this;

					api.openWin({
                        name: 'shoppingUserDetail',
                        url: '../shopping/shoppingUserDetail.html',
                        reload: true,
                        slidBackEnabled: false,
                        pageParam: {
                            userData: that.signData
                        }
                    })


					return false;
					if (that.signData.Longitude && that.signData.Latitude) {
						api.actionSheet({
							buttons: buttons
						}, function (ret, err) {
							ret.buttonIndex -= 1;
							if (ret.buttonIndex == 2) {
								return false;
							} if (!maps[ret.buttonIndex][3]) {
								if (ret.buttonIndex == 0) {
									var gd_latlng = that.bd_decrypt(that.signData.Longitude, that.signData.Latitude);
									if (api.systemType == 'ios') {
										location.href = encodeURI('iosamap://path?sourceApplication=福路德&dlat=' + gd_latlng.lat + '&dlon=' + gd_latlng.lng + '&dev=0&t=0');
									} else {
										location.href = encodeURI('amapuri://route/plan/?sourceApplication=福路德&dlat=' + gd_latlng.lat + '&dlon=' + gd_latlng.lng + '&dev=0&t=0');
									}
								} else if (ret.buttonIndex == 1) {
									if (api.systemType == 'ios') {
										location.href = encodeURI('baidumap://map/direction?destination=' + that.signData.Latitude + ',' + that.signData.Longitude + '&mode=driving&src=ios.baidu.福路德连锁');
									} else {
										location.href = encodeURI('bdapp://map/direction?destination=' + that.signData.Latitude + ',' + that.signData.Longitude + '&mode=driving&src=andr.baidu.福路德连锁');
									}
								}
							}
						})
					}

				},
				appInstalled(num) {
					var that = this;
					if ((num = num ? num : 0) < maps.length) {
						api.appInstalled({
							appBundle: api.systemType == 'ios' ? maps[num][1] : maps[num][2]
						}, function (ret, err) {
							if (ret.installed) {
								buttons.push(maps[num][0]);
								maps[num].push(false);
							} else {
								buttons.push(maps[num][0] + ' ( 未安装 )');
								maps[num].push(true);
							}
							that.appInstalled(++num);
						});
					}
				},
				bd_decrypt(bd_lng, bd_lat) {
					var X_PI = 3.14159265358979324 * 3000.0 / 180.0;
					var x = bd_lng - 0.0065;
					var y = bd_lat - 0.006;
					var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
					var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
					var gg_lng = z * Math.cos(theta);
					var gg_lat = z * Math.sin(theta);
					return { lng: gg_lng, lat: gg_lat }
				},
			}
		})
	};
</script>

</html>